<template>
  <div class="factoryWrap">
    <!-- 全局属性 -->
    <AttrCfg :form="$store.state.formJson.formObj.FACTORY.attrForm" type="FACTORY"></AttrCfg>
    <!-- 字段配置 -->
    <FiledCfg type="FACTORY" :dataSource="$store.state.formJson.formObj.FACTORY.filedList"></FiledCfg>
  </div>
</template>

<script>
import { factoryFields } from '@/views/businessAssembly/jsonComponent/constant/factoryFields.js'
export default {
  data() {
    return {}
  },
  components: {
    AttrCfg: () => import('@/views/businessAssembly/jsonComponent/base/attrCfg.vue'),
    FiledCfg: () => import('@/views/businessAssembly/jsonComponent/base/filedCfg.vue')
  },
  mounted() {
    this.init()
  },
  methods: {
    // 初始化厂区字段列表
    init() {
      if (!this.$store.state.formJson.formObj.FACTORY?.filedList?.length) {
        this.$store.state.formJson.formObj.FACTORY.filedList = []
        for (let key in factoryFields) {
          this.$store.state.formJson.formObj.FACTORY.filedList.push({
            b: key,
            mapping: '',
            hidden: 'false',
            describe: factoryFields[key]
          })
        }
      }
    }
  }
}
</script>

<style lang="less" scoped>
.factoryWrap {
  height: 600px;
  overflow-y: auto;
}
</style>
